1. Field of the Invention
The present invention relates to a recording apparatus and method, a program therefor, and a storage medium having the program stored therein. In particular, the present invention relates to a recording apparatus and method, a program therefor, and a storage medium having the program stored therein, which allow easy and proper storage of a file system even when a recording process is terminated abnormally.
2. Description of the Related Art
As a method for preventing occurrence of a seek when recording a file stream composed of a header portion, a body portion, and a footer portion onto a storage medium such as an optical disk, there is a known method of arranging (i.e., recording) the above portions in a recording area of the storage medium in the following order (i.e., in chronological order in which data of these portions appear): the body portion, the footer portion, and the header portion (see, for example, Japanese Patent Laid-open No. 2005-4853).
According to this recording method, a footer area in which the footer portion is recorded and a header area in which the header portion is recorded are located within the recording area of the storage medium so as to follow a body area in which the body portion is recorded. Therefore, a final location of the header area is not determined until the recording of the body portion is completed.
Specifically, during recording of a file, information concerning the recording area of the file is held in a memory within a recording apparatus, and at the time when the entire recording operation is completed, that information is reflected in a file system management area of the storage medium (on which the writing has been performed). For example, address information of the header area, the body area, and the footer area are held in the memory, and after the recording of the header, body, and footer portions is completed, the address information held in the memory is written to a file used for managing the file system recorded on the storage medium (i.e., information in the file system management area is updated).
Therefore, in the case where a power of the recording apparatus is erroneously turned off or a system hang-up erroneously occurs while the body portion is being written to the storage medium and thus the recording process is terminated abnormally, for example, the above-described recording method is not able to allow the file of which the recording has not been completed to be reflected in the file system in the storage medium in a format that is valid for the file system. That is, the file of which the recording has been terminated abnormally in the course of recording is regarded as “a file not recorded” in the file system.
When this occurs, salvaging means independent of a standard of the file system is required to recover the file (see, for example, Japanese Patent Laid-open No. 2006-65912). According to this method, predetermined information called a “salvage marker” is recorded at a predetermined interval when recording data on the storage medium, and when data recovery is performed after abnormal termination of the recording process, data that has not been reflected in the file system is searched for based on the markers as recorded, and information thereof is reflected in the file system.
Such a recovery method is effective particularly when the power of the recording apparatus has been erroneously turned off or the system hang-up has erroneously occurred to prevent the recording process from continuing (i.e., in the case where information concerning the recording cannot be reflected in the file system at the time of the abnormal termination).